const { defineConfig } = require('@vue/cli-service');
const path = require('path');
const setting = require('./src/setting');

function resolve(dir) {
    return path.join(__dirname, dir);
}

module.exports = defineConfig({
    publicPath: '/',
    lintOnSave: false,
    productionSourceMap: false,
    configureWebpack: {
        name: 'Home',
        devtool: 'source-map',
        resolve: {
            alias: {
                '@': resolve('src'),
            },
            fallback: {
                path: require.resolve("path-browserify")
            }
        }
    },
    css: {
        loaderOptions: {
            css: {
                importLoaders: 1,
            },
            postcss: {
                postcssOptions: {
                    plugins: [
                        require('autoprefixer')(), // 确保已安装 autoprefixer
                        // 其他 PostCSS 插件
                    ],
                },
            }
        }
    },
    devServer: {
        proxy: setting.proxyUrl,
        client: {
            overlay: false,
        },
        allowedHosts: [
            '.natappfree.cc', // 允许所有 natapp 子域名
            'localhost', // 允许本地主机名
          ],
    }
});
